package com.amphiprion.prototype.component.animation;

import android.view.animation.Interpolator;

public class ScaleComponentAnimation extends GameComponentAnimation {
	private float start;
	private float end;
	private Interpolator itp;

	public ScaleComponentAnimation(long duration, long delay, float start, float end) {
		this(duration, delay, start, end, null);
	}

	public ScaleComponentAnimation(long duration, long delay, float start, float end, Interpolator itp) {
		this.delay = delay;
		this.start = start;
		this.end = end;
		this.duration = duration;
		this.itp = itp;
	}

	@Override
	protected float getInterpolatedProgress(float progress) {
		if (itp != null) {
			return itp.getInterpolation(progress);
		}
		return super.getInterpolatedProgress(progress);
	}

	@Override
	protected void onUpdate(float progress) {
		cmp.setScale((end - start) * progress + start);

	}

	@Override
	public void start() {
	}

}
